package com.flexrrb.resizeManagerClasses
{
	import flash.display.Graphics;
	
	import mx.core.UIComponent;

	public class Border extends UIComponent
	{
		public function Border(type:String, borderWidth:Number, borderHeight:Number)
		{
			super();
			borderType=type;
			width = borderWidth;
			height = borderHeight;
		}
		protected var _borderType:String;
		protected var _borderWidth:Number;
		protected var _borderHeight:Number;
		protected var thickNess:Number = 3;

		public function get borderType():String
		{
			return _borderType;
		}

		public function set borderType(value:String):void
		{
			_borderType=value;
		}

		override protected function createChildren():void
		{
			super.createChildren();
			drawBorder();
		}

		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
		{
			super.updateDisplayList(unscaledWidth, unscaledHeight);
		}

		private function drawBorder():void
		{
			var locX:Number;
			var locY:Number;
			if(borderType == "left"){
				locX = 0;
				locY = 0;
			}else if(borderType == "right"){
				locX = width;
				locY = 0;				
			}else if(borderType == "bottom"){
				locX = 0;
				locY = 0;				
			}else if(borderType == "top"){
				locX = 0;
				locY = 0;
			}
			var g:Graphics=graphics;
			g.clear();
			g.beginFill(0x000000);
			g.moveTo(0, 0);
			g.lineTo(thickNess, 0);
			g.lineTo(thickNess, thickNess);
			g.lineTo(0, thickNess);
			g.lineTo(0, 0);
			g.endFill();
		}
	}
}